import Vue from "vue";

import App from "./App.vue";

Vue.directive("css", {
  bind(el, binding) {
    // 当指令被绑定到'dom/组件'的时候执行
    // el.style.color = "red";
    // el.style[binding.arg] = "red";
    el.style[binding.arg] = binding.value;
    if (binding.modifiers.b) {
      el.style.fontWeight = "bold";
    }
    if (binding.modifiers.i) {
      el.style.fontStyle = "italic";
    }
    if (binding.modifiers.u) {
      el.style.textDecoration = "underline";
    }
  },
  unbind() {
    // 当指'dom/组件'销毁的时候执行
  },
});

new Vue({
  render: (h) => h(App),
}).$mount("#app");
